package com.acwing.partition11;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class AC1049大盗阿福 {
    
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] s = reader.readLine().split("\\s+");
        int t = Integer.parseInt(s[0]);
        while (t-- > 0) {
            int n = Integer.parseInt(reader.readLine().split("\\s+")[0]);
            int[] stores = new int[n];
            s = reader.readLine().split("\\s+");
            for (int i = 0; i < n; i++) stores[i] = Integer.parseInt(s[i]);
            writer.write(dynamicProgramming(stores) + "\n");
        }
        writer.flush();
    }

    private static int dynamicProgramming(int[] stores) {
        int[][] dp = new int[stores.length][2];
        dp[0][0] = 0;
        dp[0][1] = stores[0];
        for (int i = 1; i < stores.length; i++) {
            //当前店不偷的话，上一家店可以偷，也可以不偷；当前店偷的话，上一家店不能偷
            dp[i][0] = Math.max(dp[i - 1][0], dp[i - 1][1]);
            dp[i][1] = dp[i - 1][0] + stores[i];
        }
        return Math.max(dp[stores.length - 1][0], dp[stores.length - 1][1]);
    }
}
